package Menu.Controller
{
	import Game.Viewport;
	
	import Menu.Model.Player;
	import Menu.View.GameSkin;
	
	import Utils.CustomEvent;
	import Utils.EventBus;
	import Utils.Vars;
	
	import spark.components.Button;
	import spark.components.SkinnableContainer;
	
	
	/**
	 * 
	 */
	public class GameCtrl extends SkinnableContainer
	{
//		[SkinPart(required="true")] public var map:Map_old;
		[SkinPart(required="true")] public var test:Button;

		/**
		 * 
		 */
		public function GameCtrl()
		{
			super();
			setStyle("skinClass", GameSkin);
		}
		
		
		/**
		 * 
		 */
		public function creationComplete():void
		{
//			Map.instance = map;
//			
//			// Test
//			var player1:Player = new Player();
//			var player2:Player = new Player();
//			map.addElement(player1.tank);
//			map.addElement(player2.tank);
//			
//			player1.tank.x = 50;
//			player1.tank.y = 50;
//			player2.tank.x = 400;
//			player2.tank.y = 50;
//			
//			MotionManager.instance.addTank(player1.tank);
//			MotionManager.instance.addTank(player2.tank);
//			
//			MotionManager.instance.Start();
//			
//			// après 3, 2, 1, Go : 
//			TankControls.instance.startListeners(player1.tank, test);
		}
		
		
		
		public function clickHandler_logOut():void
		{
			EventBus.instance.dispatchEvent(new CustomEvent(EventBus.CHANGE_PAGE, {from:Vars.PAGE_GAME, to:Vars.PAGE_LOGIN}));
		}
		
		
		public function clickHandler_quitGame():void
		{
			EventBus.instance.dispatchEvent(new CustomEvent(EventBus.CHANGE_PAGE, {from:Vars.PAGE_GAME, to:Vars.PAGE_LOBBY}));
		}
		
	} // ! class
}